package cn.com.headfree.mouldshow.dao.impl;

import cn.com.headfree.entity.TSdtPrentInfoTemp;
import cn.com.headfree.mouldshow.dao.TSdtPrentInfoTempDao;
import com.gta.edu.sdk.base.dao.impl.BaseDaoImpl;
import org.springframework.stereotype.Repository;

import java.sql.Timestamp;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;

@Repository("/tSdtPrentInfoTempDao")
public class TSdtPrentInfoTempDaoImpl extends BaseDaoImpl<TSdtPrentInfoTemp> implements TSdtPrentInfoTempDao {


    @Override
    public void saveInfo(TSdtPrentInfoTemp tSdtPrentInfoTemp) {
        String sql = "insert into t_sdt_prent_info_temp (id,sdt_id,erp_no,user_name,id_card_no,win_info,award_name,org_id,creater_id,creater_name,create_time,updater_id,updater_name,update_time,del_sign,orignal_id) values ";
        StringBuilder sqlBuilder = new StringBuilder(sql);
        sqlBuilder.append("(#{id,jdbcType=VARCHAR},").append("#{sdt_id,jdbcType=VARCHAR},")
                .append("#{erp_no,jdbcType=VARCHAR},").append("#{user_name,jdbcType=VARCHAR},")
                .append("#{id_card_no,jdbcType=VARCHAR},").append("#{win_info,jdbcType=VARCHAR},")
                .append("#{award_name,jdbcType=VARCHAR},").append("#{org_id,jdbcType=VARCHAR},").append("#{creater_id,jdbcType=VARCHAR},")
                .append("#{creater_name,jdbcType=VARCHAR},").append("#{create_time,jdbcType=DATE},")
                .append("#{updater_id,jdbcType=VARCHAR},").append("#{updater_name,jdbcType=VARCHAR},")
                .append("#{update_time,jdbcType=DATE},").append("#{del_sign,jdbcType=INTEGER},")
                .append("#{orignal_id,jdbcType=VARCHAR})");
        Map<String, Object> params = new HashMap<String, Object>();
        params.put("id", tSdtPrentInfoTemp.getId());
        params.put("sdt_id", tSdtPrentInfoTemp.getSdtId());
        params.put("erp_no", tSdtPrentInfoTemp.getErpNo());
        params.put("user_name", tSdtPrentInfoTemp.getUserName());
        params.put("id_card_no", tSdtPrentInfoTemp.getIdCardNo());
        params.put("win_info", tSdtPrentInfoTemp.getWinInfo());
        params.put("award_name", tSdtPrentInfoTemp.getAwardName());
        params.put("org_id", tSdtPrentInfoTemp.getOrgId());
        params.put("creater_id", tSdtPrentInfoTemp.getCreaterId());
        params.put("creater_name", tSdtPrentInfoTemp.getCreaterName());
        params.put("create_time", new Timestamp(new Date().getTime()));
        params.put("updater_id", tSdtPrentInfoTemp.getUpdaterId());
        params.put("updater_name", tSdtPrentInfoTemp.getUpdaterName());
        params.put("update_time", new Timestamp(new Date().getTime()));
        params.put("del_sign", 0);
        params.put("orignal_id", tSdtPrentInfoTemp.getOrignalId());
        this.executeSql(sqlBuilder.toString(), params);
    }
}
